package javachess;

import java.util.Vector;

public class Player
{
	/**
	 * Player's ID number
	 */
	int m_id;
	/**
	 * Player's timer
	 */
	long m_timer;
	
	/**
	 * Player's color
	 */
	//we need a color otherwise the id would need to be the color
	// or the piece needs a color, piece might be better. 
	// or we can pass in the player's color when we make the pieces.
	// i tried doing that in the C++ chess
	// and had to make a switch statement each time i wanted to print the color
	int m_color;
	
	/**
	 * a vector of pieces that the player owns
	 */
	Vector<Piece> m_pieces = new Vector<Piece>();
	
	
	/**
	 * Constructor for the Player
	 * Gives them all their pieces too
	 * @param id is the player's number
	 */
	public Player(int id, int c)
	{
		m_id = id;
		m_color = c;
		
		//this part for putting pawns at the top or bottom
		int temp;
		if(m_id == 0)
			temp = 1;
		else
			temp = 6;
		
		//pawns
		for(int i = 0; i < 8; ++i)
		{
			m_pieces.add(new Pawn(m_id, i, temp));
		}
		if(m_id ==  0)
			temp = 0;
		else
			temp = 7;
		
		//rooks
		m_pieces.add(new Rook(m_id, 0, temp));
		m_pieces.add(new Rook(m_id, 7, temp));
		
		//bishops
		m_pieces.add(new Bishop(m_id, 2, temp));
		m_pieces.add(new Bishop(m_id, 5, temp));
		
		//knight
		m_pieces.add(new Knight(m_id, 1, temp));
		m_pieces.add(new Knight(m_id, 6, temp));
		
		//if the board is supposed to be symmetrical 
		//or if its not, then k = 3, q = 4
		//int k, q;
		//if(m_id == 0){k = 3;q = 4;}	
		//else{k  = 4;q = 3;}
	
		//king
		m_pieces.add(new King(m_id, 4, temp));
		//queen
		m_pieces.add(new Queen(m_id, 3, temp));
	}
}
